package com.geovis.emergency.spd.controller.system;


import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.geovis.common.auth.pojo.dto.AccessToken;
import com.geovis.common.auth.pojo.dto.LoginDTO;
import com.geovis.common.auth.props.AuthProperties;
import com.geovis.common.auth.util.AuthUtil;
import com.geovis.common.core.api.Result;
import com.geovis.common.core.controller.BaseController;
import com.geovis.common.mybatis.page.PageParam;
import com.geovis.common.mybatis.page.PageResult;
import com.geovis.emergency.spd.biz.system.service.ISystemAdminUserService;
import com.geovis.emergency.spd.biz.system.service.ISystemUserService;
import com.geovis.emergency.spd.biz.zwdd.service.IZwddServcie;
import com.geovis.emergency.spd.entity.system.entity.SystemAdminUser;
import com.geovis.emergency.spd.entity.system.entity.SystemUser;
import com.geovis.emergency.spd.entity.system.pojo.dto.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 管理员信息表 前端控制器
 * </p>
 *
 * @author 王响
 * @since 2020-07-15
 */
@RestController
@RequestMapping("/system/systemAdminUser")
@RequiredArgsConstructor
@Api(value = "人员管理模块-管理员设置相关接口", tags = "人员管理模块-管理员设置相关接口")
@Slf4j
@Validated
public class SystemAdminUserController extends BaseController<ISystemAdminUserService> {



    @ApiOperation(value = "保存管理员信息", notes = "保存管理员信息")
    @PostMapping({"/save"})
    public Result<String> save(@Validated @RequestBody SystemAdminUserSaveDTO saveDTO) {
        baseService.save(saveDTO);
        return Result.ok();
    }


    @ApiOperation(value = "查询管理员信息列表", notes = "查询用户信息列表")
    @PostMapping("/list")
    public Result<List<SystemAdminUser>> list(String realName,String phone) {
        return Result.ok(baseService.list(realName,phone));
    }

    @ApiOperation(value = "删除管理员信息", notes = "删除管理员信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="path",name="id",dataType="String",required=true,value="管理员记录id")
    })
    @PostMapping("/remove/{id}")
    public Result<String> remove(@PathVariable("id") String id) {
        baseService.remove(id);
        return Result.ok();
    }


}
